export function tranListToTreeData(arr) {
  const list = []
  const obj = {}
  arr.forEach(item => {
    if (!item.children) {
      item.children = []
    }
    obj[item.id] = item
  })
  arr.forEach(item => {
    const parents = obj[item.pid]
    if (parents) {
      parents.children.push(item)
    } else {
      list.push(item)
    }
  })
  return list
}
